<template>
<div>
  <a-card :bordered="false">
    <a-steps :current="current">
      <a-step size="small" v-for="item in steps" :key="item.title" :title="item.title" />
    </a-steps>
  </a-card>
  <a-card :bordered="false" style='margin-top: 5px'>
    <step1 v-show='current===0' ref='step1'></step1>
    <step2 v-show='current===1' :ds='ds' ref='step2' ></step2>
    <step3 v-show='current===2' :ds='ds' ref='step3'></step3>
    <step4 v-show='current===3' :ds='ds' ref='step4'></step4>

    <div style='margin-top: 10px;text-align: center;'>
        <a-button style='margin-right: 10px' type='primary' @click='previous' v-show='current>0'>上一步</a-button>
        <a-button style='margin-left: 10px' type='primary' @click='next' v-show='current<3'>下一步</a-button>
      <a-button style='margin-left: 10px' type='primary' @click='finish' v-show='current===3'>完成</a-button>
    </div>
  </a-card>
</div>
</template>

<script>
import Step1 from '@views/data-governance/smart-reports/epidemic-daily/StatisticsStep/Step1'
import Step2 from '@views/data-governance/smart-reports/epidemic-daily/StatisticsStep/Step2'
import Step3 from '@views/data-governance/smart-reports/epidemic-daily/StatisticsStep/Step3'
import Step4 from '@views/data-governance/smart-reports/epidemic-daily/StatisticsStep/Step4'
import moment from 'moment'
import ReportsEpidemicDailyService from '@/myService/ReportsEpidemicDailyService'

export default {
  name: 'StatisticsAdd',
  components:{
    Step1,
    Step2,
    Step3,
    Step4
  },
  data(){
    return{
      current: 0,
      steps: [{title: '生成数据'},{title: '模板统计'},{title: '新增数量'},{title: '统计汇总'},],
      ds:''
    }
  },
  created() {
  },
  methods:{
    next(){
      if(this.current===0){
        this.ds=this.$refs.step1.ds.toString().replace(/-/g,'')
        this.$refs.step2.begin(this.ds);
      }
      if(this.current===1){
        this.$refs.step3.begin(this.ds);
      }
      if(this.current===2){
        this.$refs.step4.begin(this.ds);
      }
      this.current++;
    },
    previous() {
      this.current--;
    },
    finish(){
      ReportsEpidemicDailyService.generateSummary(this.ds);
      this.$router.push('/report/statistics-epidemic-daily-home')
    }
  }
}
</script>

<style scoped>

</style>